package com.asset.dispoal.business.mediation.service.converter;

import com.asset.dispoal.business.bsAgreement.domain.db.entity.AgreementInfo;
import com.asset.dispoal.business.bsCase.domain.db.entity.BsCase;
import com.asset.dispoal.business.mediation.domain.db.entity.ReduceAgreementTmp;
import com.asset.dispoal.business.mediation.domain.db.entity.ReduceOperate;
import com.asset.dispoal.business.mediation.domain.db.entity.ReduceStagingTmp;
import com.asset.dispoal.business.mediation.domain.db.entity.ReduceWayTmp;
import com.asset.dispoal.business.mediation.dto.AgreementResponse;
import com.asset.dispoal.business.mediation.dto.MediationRequest;
import com.asset.dispoal.business.mediation.dto.MediationResponse;
import com.asset.dispoal.business.mediation.dto.ReduceLogsResponse;
import com.asset.dispoal.business.mediation.dto.ReducePreInfo;
import com.asset.dispoal.business.mediation.dto.StagingInfo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @description:
 * @author: yf
 * @date: 2022-08-26 09:14:11
 */
@Mapper
public interface MediationConverter {
    MediationConverter INSTANCE = Mappers.getMapper(MediationConverter.class);

    BsCase reqToDoM(MediationRequest request);

    List<MediationResponse> dosToResM(List<BsCase> bsCaseList);

    List<AgreementResponse> dosToResA(List<AgreementInfo> agreementInfos);

    @Mappings({
            @Mapping(target = "lawsuitPrincipalAmount", source = "lawsuitPrincipalAmount"),
            @Mapping(target = "lawsuitInterestAmount", source = "lawsuitInterestAmount"),
            @Mapping(target = "litigationFines", source = "litigationFines"),
            @Mapping(target = "totalAmt", source = "totalAmt")
    })
    List<ReduceAgreementTmp> reqToDoRedAg(List<com.asset.dispoal.business.mediation.dto.AgreementInfo> request);

    @Mappings({
            @Mapping(target = "lawsuitPrincipalAmount", source = "lawsuitPrincipalAmount"),
            @Mapping(target = "lawsuitInterestAmount", source = "lawsuitInterestAmount"),
            @Mapping(target = "litigationFines", source = "litigationFines"),
            @Mapping(target = "totalAmt", source = "totalAmt")
    })
    List<ReduceWayTmp> reqToDoRedWt(List<ReducePreInfo> request);

    @Mappings({
            @Mapping(target = "lawsuitPrincipalAmount", source = "lawsuitPrincipalAmount"),
            @Mapping(target = "lawsuitInterestAmount", source = "lawsuitInterestAmount"),
            @Mapping(target = "litigationFines", source = "litigationFines"),
            @Mapping(target = "totalAmt", source = "totalAmt")
    })
    List<ReduceStagingTmp> reqToDoRedSt(List<StagingInfo> request);

    List<ReduceLogsResponse> dosToResRO(List<ReduceOperate> operateList);

    @Mappings({
            @Mapping(target = "lawsuitPrincipalAmount", source = "lawsuitPrincipalAmount"),
            @Mapping(target = "lawsuitInterestAmount", source = "lawsuitInterestAmount"),
            @Mapping(target = "litigationFines", source = "litigationFines"),
            @Mapping(target = "totalAmt", source = "totalAmt")
    })
    List<AgreementResponse> dosToResAR(List<ReduceAgreementTmp> reduceAgreementTmpList);

    @Mappings({
            @Mapping(target = "lawsuitPrincipalAmount", source = "lawsuitPrincipalAmount"),
            @Mapping(target = "lawsuitInterestAmount", source = "lawsuitInterestAmount"),
            @Mapping(target = "litigationFines", source = "litigationFines"),
            @Mapping(target = "totalAmt", source = "totalAmt")
    })
    List<ReducePreInfo> dosToResRW(List<ReduceWayTmp> reduceWayTmpList);

    @Mappings({
            @Mapping(target = "lawsuitPrincipalAmount", source = "lawsuitPrincipalAmount"),
            @Mapping(target = "lawsuitInterestAmount", source = "lawsuitInterestAmount"),
            @Mapping(target = "litigationFines", source = "litigationFines"),
            @Mapping(target = "totalAmt", source = "totalAmt")
    })
    List<StagingInfo> dosToResRS(List<ReduceStagingTmp> reduceStagingTmpList);
}
